home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 13
/
013.d81
/
comal tutor
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
14KB
|
363 lines
5 ifpeek(51200)<>76orpeek(52016)<>32then7
6 ifpeek(52080)=173andpeek(52176)=169then8
7 load"routines v4",8,1
8 pokev+33,1:q$=chr$(34)
10 r=53265:c=128:v=53248:s=v+1024:li=52016:wi=51200:cl=51203:su=51206:sd=51209
12 pokes+23,.:pokes+4,128:pokev+32,14
15 gosub 1000:print" [215]elcome to the first installment of"
16 print"[204]oadstar's [195][207][205][193][204][160]0.14 [212]utorial. [212]his
17 [153]"series of articles assumes no know-
18 print"ledge of programming on your part.
19 [153]"right$ndeed, the purpose is to teach len(NULL)(NULL)atn(NULL)
20 print"programming from the beginning,
21 [153]"without the 'corrupting' influences of
22 print"[194][193][211][201][195].
23 [153]" right$ will not go into the relative
24 print"pros & cons of [194][193][211][201][195][160]and [195][207][205][193][204], just
25 [153]"suffice it to say that len(NULL)(NULL)atn(NULL)closeis
26 print"superior to [194][193][211][201][195] as a language for
27 [153]"first time programmers. right$t is similar
28 print"in structure to the more 'serious'
29 [153]"languages ((NULL)ascal, (NULL)odula 2, etc.).
30 s%=-1:gosub1200
31 print" [211]ince [195][207][205][193][204] 0.14, unlike [194][193][211][201][195], is
32 [153]"not built into the 64; you must (NULL)(NULL)atnstr$
33 print"it into the 64's 'memory'[160](or [210][193][205]) be-
34 [153]"fore you can use it. (NULL)o do so, you
35 print"must have a copy of the [195][207][205][193][204][160]0.14
36 [153]"(NULL)ampler str$isk. ((NULL)ee the len(NULL)(NULL)atn(NULL)closelenorner
37 print"about [204]oadstar's own special [195][207][205][193][204]
38 [153]"offer!) (NULL)imply turn your computer
39 print"system on, wait for the [194][193][211][201][195] startup
40 [153]"screen to appear, then insert your
41 print"[195][207][205][193][204][160]0.14 [211]ampler [196]isk into the disk
42 [153]"drive and close the disk drive door.
43 print"[215]hen all is ready, just do the fol-
44 [153]"lowing (but (NULL)(NULL)(NULL)close(NULL)(NULL)(NULL)!!!!):
50 gosub1200
51 print"[212]ype the following line to boot "
52 print"your [195][207][205][193][204] disk:
53 [153]" (NULL)(NULL)atnstr$"q$"len*"q$",8:
54 print"[208]ress and hold a [[211][200][201][198][212]] key."
55 print"[215]hile holding it, press the key"
56 print"marked [[210][213][206]-[211][212][207][208]], then release both
57 [153]"it and the [(NULL)left$right$asc(NULL)]closekey. (NULL)our screen
58 print"should display:
59 [153]" (NULL)(NULL)atnstr$"q$"len*"q$",8:(NULL)(NULL)atnstr$":[153]" (NULL)valatn(NULL)lenleft$right$(NULL)chr$closeasc(NULL)(NULL)closelen*
60 print" [204][207][193][196][201][206][199]":print" [210][197][193][196][217]. ([193]bout 1.5 minutes later.)
65 [153]" (NULL)(NULL)(NULL)":[141]1200
70 [153]"len(NULL)(NULL)atn(NULL)closethen displays its title and
71 print"copyright screen. [193]t the bottom, it
72 [153]"informs you that you have 9902 bytes
73 print"free. [196]on't worry about what a 'byte'
74 [153]"is for now. (NULL)he important thing is
75 print"that [195][207][205][193][204][160]0.14 is now running on your
76 [153]"own lenommodore 64!
77 print" [193]t this point, [195][207][205][193][204][160]is in [195]ommand
78 [153]"mode. (NULL)his simply means that len(NULL)(NULL)atn(NULL)closeis
79 print"waiting for you to give it a task to
80 [153]"do. str$on't worry, it won't get bored
81 print"waiting!
82 [153]" left$ere is what the len(NULL)(NULL)atn(NULL)closelenommand (NULL)ode
83 print"looks like:
85 [141]1200:x%[178]0:y%[178]20:[153]"9902 peek(NULL)(NULL)val(NULL)closeasc(NULL)valval."
90 [153]" atnt the bottom of the screen is a
91 print"small simulated 'screen'. [201]t is show-
93 [153]"ing the 'peekytes ascree' message.
94 print" [193]t this point, we are in [195]ommand
95 [153]"(NULL)ode. ascrom here, you can type in com-
96 print"mands, direct statements and deferred
97 [153]"statements. atn 'command' is precisely
98 print"that - a 'command' to the [195][207][205][193][204][160]sys-
99 [153]"tem, instructing it to perform some
100 print"direct action. [195]ommands are [206][207][212] part
101 [153]"of the len(NULL)(NULL)atn(NULL)closelanguage itself, they are
102 print"rather special instructions that help
103 [153]"manage len(NULL)(NULL)atn(NULL) programs.
105 gosub1200
106 print" [207]ne such command is '[204][201][211][212]', which
107 [153]"tells len(NULL)(NULL)atn(NULL) to list the current pro-
108 print"gram lines (if any)[160]onto the screen.
109 [153]" (NULL)ry it now! (NULL)ype the word '(NULL)right$(NULL)(NULL)':
110 gosub1160:gosub1300
111 x%=.:y%=22:a$="[204][201][211][212]":gosub1600
112 ifethena$=mid$(a$,e):e=.:gosub1605:goto112
113 gosub1150:print"[144][146][206]ow you can press the [[210][197][212][213][210][206]] key:":x%=4:y%=22
114 gosub1500:ifk$<>chr$(13)then114
115 gosub1150:print" [200]mmm . . . didn't do much, did it?
116 [153]"atnctually, that's because there is no
117 print"[195][207][205][193][204] program in memory to [204][201][211][212]!
118 [153]" right$n that case, let's place a short
119 print"program in memory, say, one to convert
120 [153]"a temperature expressed in degrees
121 print"[198]arenheit into a temperature expressed
122 [153]"in degrees lenelsius.
125 gosub1205
126 print" [198]or right now, we won't concern
127 [153]"ourselves with how the program oper-
128 print"ates, but rather how to get it into
129 [153]"the 64's memory. (NULL)o start, just type
130 print"the word '[193][213][212][207]':
131 [141]1160:[141]1300:x%[178].:y%[178]24:a$[178]"atn(NULL)(NULL)(NULL)":[141]1600
132 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]132
133 [141]1150:[153]"stopwait(NULL)ow you can press the [(NULL)val(NULL)(NULL)(NULL)(NULL)] key:":x%[178]4:y%[178]24
134 [141]1500:[139]k$[179][177][199](13)[167]134
135 [141]1700:[141]1700:[153]"0010 wait";:[141]1035:[141]1150
136 [153]"stop (NULL)he '0010' is a 'line number',
137 print"automatically supplied for you by the
138 [153]"'atn(NULL)(NULL)(NULL)'closecommand you just typed. (NULL)ine
139 print"numbers are used only for editing pur-
140 [153]"poses in len(NULL)(NULL)atn(NULL). (NULL)ow type this line:
142 print" [201][206][208][213][212]"q$"[196][197][199][210][197][197][211] [198]?[160]"q$":[198][193][210][197][206][200][197][201][212]
143 [141]1160:x%[178]5:y%[178]24
144 a$[178]"right$(NULL)(NULL)(NULL)(NULL)"[170]q$[170]"str$valchr$(NULL)valval(NULL) asc? "[170]q$[170]":ascatn(NULL)val(NULL)left$valright$(NULL)":[141]1600
145 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]145
146 [141]1150:[153]"stopwait(NULL)ow you can press the [(NULL)val(NULL)(NULL)(NULL)(NULL)] key:":x%[178]33:y%[178]24
147 [141]1500:[139]k$[179][177][199](13)[167]147
148 [141]1700:[153]"0020 wait";:[141]1035:[141]1150
150 [141]1400
151 [153]"(NULL)ery good! (NULL)ow type this:"
152 [153]" lenval(NULL)(NULL)right$(NULL)(NULL):=(ascatn(NULL)val(NULL)left$valright$(NULL)-32)*(5/9)
153 gosub1160:gosub1300:x%=5:y%=24
154 a$="[195][197][204][211][201][213][211]:=([198][193][210][197][206][200][197][201][212]-32)*(5/9)":gosub1600
155 ifethena$=mid$(a$,e):e=.:gosub1605:goto155
156 gosub1150:print"[144][146][206]ow you can press the [[210][197][212][213][210][206]] key:":x%=34:y%=24
157 gosub1500:ifk$<>chr$(13)then157
158 gosub1700:print"0030 [146]";:gosub1035:gosub1150
160 print"[144][199]reat! [206]ow type this one last line:
161 [153]" (NULL)(NULL)right$(NULL)(NULL) ascatn(NULL)val(NULL)left$valright$(NULL);"q$"asc ="q$";lenval(NULL)(NULL)right$(NULL)(NULL);"q$"len"q$
162 [141]1160:x%[178]5:y%[178]24
163 a$[178]"(NULL)(NULL)right$(NULL)(NULL) ascatn(NULL)val(NULL)left$valright$(NULL);"[170]q$[170]"asc ="[170]q$[170]";lenval(NULL)(NULL)right$(NULL)(NULL);"[170]q$[170]"len"[170]q$:[141]1600
164 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]164
165 [141]1150:[153]"stopwait(NULL)ow you can press the [(NULL)val(NULL)(NULL)(NULL)(NULL)] key:":x%[178]38:y%[178]24
166 [141]1500:[139]k$[179][177][199](13)[167]166
167 [141]1700:[153]"0040 wait";:[141]1035: